package com.factory.iamp.utils.helper;

import com.factory.iamp.dao.LineMapper;
import com.factory.iamp.pojo.LinePermission;
import com.factory.iamp.pojo.User;

import javax.annotation.Resource;

public class LinePermissionChecker {
    @Resource
    LineMapper lineMapper;

    public boolean hasReadPermission(User user) {
        LinePermission res = lineMapper.getPermission(user.getLine(), user.getUid());
        return (res != null) && (res.getR() != 0);
    }

    public boolean hasWritePermission(User user) {
        LinePermission res = lineMapper.getPermission(user.getLine(), user.getUid());
        return (res != null) && (res.getW() != 0);
    }
}
